﻿@model VisaApp.Models.UserModel

@{
    Layout = null;
    AjaxOptions ajaxOp = new AjaxOptions()
    {
        HttpMethod = "Post",
        OnComplete = "completedAjaxRequestCategoey"
    };
}

<!DOCTYPE html>

<html>
<head>
    <title>Đăng nhập hệ thống quản trị web site | tinbatdongsan24h.com.vn</title>
     <link href="/Content/themes-ui/honolo-theme/jquery.ui.all.css" rel="stylesheet"
        type="text/css" />
     <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")"  type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/custom.js")"  type="text/javascript"></script>
    <link href="/Content/LoginCss.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function completedAjaxRequestCategoey(obj) {
            var returnObj = eval('(' + obj.responseText + ')');

            if (returnObj.Status == "success") {
                if (returnObj.Message != null) {
                    makeSuccessHighlight(returnObj.Message);
                }
                else if (returnObj.RedirectUrl != null) {
                    window.location.href = returnObj.RedirectUrl;
                }
            } else {
                makeErrorHighlight(returnObj.Message);
            }

            return false;
        }

        function makeErrorHighlight(messageStr) {
            var $highlight = $("<div style='padding: 0.7em; margin-bottom:5px; width: inherit;'><p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span><strong>Alert: </strong>" + messageStr + "</p></div>");
            $highlight.addClass("ui-state-highlight ui-corner-all");
            $highlight.prependTo(".warning-area");
            $highlight.delay(4000).fadeOut(500);
        }

        function makeSuccessHighlight(messageStr) {
            var $highlight = $("<div style='padding: 0.7em; margin-bottom:5px; width: inherit;'><p><span class='ui-icon ui-icon-info' style='float: left; margin-right: .3em;'></span><strong>Success: </strong>" + messageStr + "</p></div>");
            $highlight.addClass("ui-state-highlight ui-corner-all");
            $highlight.prependTo(".warning-area");
            $highlight.delay(4000).fadeOut(500);
        }


</script>


</head>
<body>
    <div class="fromLogin">
        @using (Ajax.BeginForm("Dangnhap", "Quantri", null, ajaxOp, new { enctype = "multipart/form-data" }))
        {
            <h2>Đăng nhập hệ thông quản trị web</h2>
            
            <table>
                <tr>
                    <td colspan="2">
                        <div class="warning-area"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="left">Tên đăng nhập</span>
                    </td>
                    <td>
                        <span class="right">@Html.TextBoxFor(model => model.UserName, new { style ="width:300px"})</span>
                    </td>
                </tr>
                 <tr>
                    <td>
                        <span class="left">Mật khẩu</span>
                    </td>
                    <td>
                         <span class="right">@Html.PasswordFor(model => model.UserPass, new { style ="width:300px"})</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" value="Đăng nhập" />
                    </td>
                </tr>
            </table>
        }
    </div>
</body>
</html>
